﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zeus.Domain.GameSdk.Model.Log;
using Zeus.SamusMongo;

namespace Zeus.DataMongo.GameSdk.Repositories
{
    public class MongoLogRepository : BaseMongoRepository, ILogRepository
    {
        private GenericMongo<SdkLog> mongo;
        private string collName = "Log";

        public MongoLogRepository()
        {
            this.mongo = new GenericMongo<SdkLog>(connStr, dbName, collName);
        }

        public void Add(SdkLog log)
        {
            mongo.Insert(log);
        }

        public SdkLog QueryById(string id)
        {
            return mongo.Single(p => p.ID == id);
        }

        public void UpdateSingle(string id, SdkLog log)
        {
            mongo.Update(log, i => i.ID == id);
        }
    }
}
